<template>
  <div class="hello">
    <router-link :to="'/home/listmessage/' + 1" tag="div" class="hello_list" v-for="(item,index) in list" :key="index">
        <img :src="item.img_url" alt="" class="hello_list_img">
        <div class="hello_list_continer">
          <div class="hello_lc_title" v-text="item.title"></div>
          <div class="hello_lc_message">
            <div class="hello_lm_time">发表于{{item.add_time | setTime}}</div>
            <div class="hello_lm_number">浏览:{{item.click}}次</div>
          </div>
        </div>
    </router-link>
  </div>
</template>

<script>
export default {
  name: 'news',
  data(){
    return{
      list:[]
    }
  },
  // filters:{
  //   setTime(timer){
  //     var t = new Date(timer);
  //     var year = t.getFullYear();
  //     var mount = t.getMonth();
  //     var day = t.getDate();
  //     var hours = t.getHours();
  //     var second = t.getSeconds();
  //     var minute = t.getMinutes();
  //     return year + '-' +mount + '-' + day + ' ' + hours + ':' + second + ':' + minute;

  //   }
  // },
  methods:{
    getlsit(){
      this.$axios.get("http://www.liulongbin.top:3005/api/getnewslist").then(res =>{
        console.log(res.data);
        if(res.data.status == 0){
          this.list = res.data.message;
        }
      })
    }
  },
  created(){
    this.getlsit();
  }
}
</script>
 
<style scoped>
  .hello_list{
    width:calc(100% - 15px);
    margin-left:15px;
    display: flex;
    flex-direction: row;
    border-bottom:1px solid #e2e2e2;
    padding:5px;
    box-sizing: border-box;
  }
  .hello_list_img{
    width:60px;
    height: 60px;
  }
  .hello_list_continer{
    flex:1;
    margin-left:5px;
  }
  .hello_lc_title{
    width:200px;
    font-size:16px;
    font-weight: bold;
    color:#333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 30px;
  }
  .hello_lc_message{
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    color:#7DADFB;
    font-size:14px;
    line-height: 20px;
  }
</style>
